//----------------------------------*-C++-*----------------------------------//
/*!
 * \file   BaseInput.hh
 * \author Jeremy Roberts
 * \date   Aug 31, 2011
 * \brief  BaseInput class definition.
 * \note   Copyright (C) 2011 Jeremy Roberts. 
 */
//---------------------------------------------------------------------------//
// $Rev:: 125                                           $:Rev of last commit
// $Author:: j.alyn.roberts@gmail.com                   $:Author of last commit
// $Date:: 2011-09-02 00:41:14 +0000 (Fri, 02 Sep 2011) $:Date of last commit
//---------------------------------------------------------------------------//

#ifndef BASEINPUT_HH_
#define BASEINPUT_HH_

#include <string>

#include "../utilities/SP.hh"

namespace slabtran
{

//===========================================================================//
/*!
 *  \class BaseInput
 *  \brief Base class for slabtran input approaches.
 *
 *  This class holds all standard input data used to control problem
 *  flow.  The idea for this is that input will come in different forms
 *  for flexibility.  Processing those various forms will be specializations
 *  of this class.
 *
 */

class BaseInput
{

public:

  /// Typedef to me.
  typedef util::SP<BaseInput> SP_input;

  /*
   *  \brief Process a user's input file.
   *
   *  \param    inputfile   String name of input file.
   *  \return   True if successful processing.
   */
  virtual bool process(std::string inputfile) = 0;

  // potentially things related to materials and geometry

  /// \name Accessors
  //\{

  //---------------------------------------------------------------------------
  //  Problem description.

  /// Problem name.
  std::string problem_name() const { return d_problem_name; }

  /// Problem type (0 for fixed source, 1 for eigenvalue, 2 for response function)
  int problem_type() const { return d_problem_type; }

  /// Problem spatial dimensions (1/2/3)
  int dimension() const { return d_dimension; }

  /// Coordinate system (0 for Cartesian, ...)
  int coordinate_system() const { return d_coordinate_system; }

  /// Number of groups.
  int number_groups() const { return d_number_groups; }

  /// Legendre order for scattering.
  int legendre_order() const { return d_legendre_order; }

  /// Legendre order for flux expansions (>= d_legendre_order)
  int legendre_order_flux() const { return d_legendre_order_flux; }

  //---------------------------------------------------------------------------
  //  Geometry description.
  int number_elements() const { return d_number_elements; }

  //---------------------------------------------------------------------------
  //  Solver options.

  /// Transport solver (0 for discrete ordinates, ... )
  int transport_solver_type() const { return d_transport_solver_type; };

  /// Within group solver (0=SI, ... )
  int within_group_solver() const { return d_within_group_solver; };

  /// Group solver (0=GS, ... )
  int group_solver() const { return d_group_solver; };

  /// Eigenvalue solver (0=PI, ... )
  int eigenvalue_solver() const { return d_eigenvalue_solver; }

  /// Upscattering switch.
  bool upscatter_on() const { return d_upscatter_on; }

  /// Fission switch.  (Turn on/off multiplication for fixed source problems).
  bool fission_on() const { return d_fission_on; }

  /// Angular flux storage switch.
  bool store_psi() const { return d_store_psi; }

  /// Flux moment tolerance.
  double tolerance_flux() const { d_tolerance_flux; }

  /// Eigenvalue tolerance.
  double tolerance_keff() const { d_tolerance_keff; }

  /// Maximum within group iteration count.
  int max_iterations_within_group() const { return d_max_iterations_within_group; }

  /// Maximum group iteration count.
  int max_iterations_group() const { return d_max_iterations_group; }

  /// Maximum outer iteration count.
  int max_iterations_outer() const { return d_max_iterations_outer; }

  // Angular mesh options.

  /// Quadrature order.
  int quadrature_order() const { return d_quadrature_order; }

  /// Quadrature type (see \ref QID)
  int quadrature_type() const { return d_quadrature_type; }

  // Response function stuff.


  // Output control.

  /// Runtime output flag. (0=stdout, 1=file, 2=silent)
  int print_output() const { return d_print_output; }

  /// ASCII moments output flag.
  bool print_ascii_moments() const { return d_print_ascii_moments; }

  /// Silo moments output flag.
  bool print_silo_moments() const { return d_print_silo_moments; }

  /// ASCII angular flux output flag.
  bool print_ascii_psi() const { return d_print_ascii_psi; }

  /// Silo angular flux output flag.
  bool print_silo_psi() const { return d_print_silo_psi; }

  // Material information.



  //\}

protected:

  /// \name Basic problem description.
  //\{

  /// Problem name.
  std::string d_problem_name;

  /// Problem type (0 for fixed source, 1 for eigenvalue, 2 for response function)
  int d_problem_type;

  /// Problem spatial dimensions (1/2/3)
  int d_dimension;

  /// Coordinate system (0 for Cartesian, ...)
  int d_coordinate_system;

  /// Number of groups.
  int d_number_groups;

  /// Legendre order for scattering.
  int d_legendre_order;

  /// Legendre order for flux expansions (>= d_legendre_order)
  int d_legendre_order_flux;

  //\}

  /// \name Geometry description(s).
  //\{
  int d_number_elements;


  //\}

  /// \name Angular mesh options.
  //\{

  /// Quadrature order.
  int d_quadrature_order;

  /// Quadrature type (see \ref QID)
  int d_quadrature_type;

  //\}


  /// \name Solver options.
  //\{

  /// Transport solver (0 for discrete ordinates, ... )
  int d_transport_solver_type;

  /// Within group solver (0=SI, ... )
  int d_within_group_solver;

  /// Group solver (0=GS, ... )
  int d_group_solver;

  /// Eigenvalue solver (0=PI, ... )
  int d_eigenvalue_solver;

  /// Upscattering switch.
  bool d_upscatter_on;

  /// Fission switch.  (Turn on/off multiplication for fixed source problems).
  bool d_fission_on;

  /// Angular flux storage switch.
  bool d_store_psi;

  /// Flux moment tolerance.
  double d_tolerance_flux;

  /// Eigenvalue tolerance.
  double d_tolerance_keff;

  /// Maximum within group iteration count.
  int d_max_iterations_within_group;

  /// Maximum group iteration count.
  int d_max_iterations_group;

  /// Maximum outer iteration count.
  int d_max_iterations_outer;

  //\}

  /// \name Material information.
  //\{

  //\}

  /// \name Output control.
  //\{

  /// \note All files prepended by \ref d_problem_name.

  /// Runtime output flag. (0=stdout, 1=file, 2=silent)
  int d_print_output;

  /// ASCII moments output flag.
  bool d_print_ascii_moments;

  /// Silo moments output flag.
  bool d_print_silo_moments;

  /// ASCII angular flux output flag.
  bool d_print_ascii_psi;

  /// Silo angular flux output flag.
  bool d_print_silo_psi;

  //\}

};


} // end namespace slabtran

#endif /* BASEINPUT_HH_ */

//---------------------------------------------------------------------------//
//              end of BaseInput.hh
//---------------------------------------------------------------------------//
